package _base0to1;

/**
 * 1056. 易混淆数
 */
public class No1056 {
    public boolean confusingNumber(int n) {
        String temp = n + "";
        char[] charArray = temp.toCharArray();
        int length = charArray.length;
        char[] reverseArray = new char[length];
        for (int i = 0; i < length; i++) {
            char c = charArray[length - i - 1];
            if (c == '2' || c == '3' || c == '4' || c == '5' || c == '7') return false;
            reverseArray[i] = switch (c) {
                case '6' -> '9';
                case '9' -> '6';
                default -> c;
            };
        }
        return !temp.equals(new String(reverseArray));
    }
}
